package charles.testproject.guithreads;

import java.awt.Button;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;

public class GUIThreadsDemo {

	public GUIThreadsDemo() {
		JFrame jf = new JFrame("GUIThreadsDemo");
		jf.setSize(160,90);
		jf.setVisible(true);
	}
	
	public static void main(String[] args) {
		GUIThreadsDemo g = new GUIThreadsDemo();
		showThreads();
	}

	private static void showThreads() {
		//当前活动的线程数目
		int num = Thread.activeCount();
		//根据当前的线程数目初始化一个线程数组
		Thread[] tg = new Thread[num];
		//将当前线程的线程组及其子组中的每一个活动线程复制到指定的数组<code>tg<\code>中
		Thread.enumerate(tg);
		//打印信息
		System.out.println("The number of the currentThread = " + num);
		System.out.println("The Name of the currentThread : ");
		for(int i = 0 ; i < tg.length; i++) {
			System.out.println(tg[i].getName());
		}
	}
}